package com.zb.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zb.dto.UserDTO;
import com.zb.entity.TbUserModel;
import com.zb.service.TbUserService;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName TbUserController
 * @Description 用户表控制器
 * @Author xm
 * @Date 2024/11/11 17:40
 **/
@RestController
@RequestMapping("/tb-user-model")
	public class TbUserController {


	@Autowired
	public TbUserService tbUserModelService;


	@GetMapping("/info/{username}")
	public UserDTO getUserInfo(@PathVariable("username") String username){
		LambdaQueryWrapper<TbUserModel> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(TbUserModel::getUsername,username);
		TbUserModel tbUserModel = tbUserModelService.getOne(queryWrapper);
		UserDTO userDTO = new UserDTO();
		BeanUtils.copyProperties(tbUserModel,userDTO);
		return userDTO;
	}




}
